<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSmsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sms', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->default(0);
            $table->string('phone_num');
            $table->string('code');
            $table->dateTime('send_time');
            $table->char('status', 2)->comment('S(send) O(OK) E(ERROR)');
            $table->string('type')->default('REG');
            $table->integer('available_time')->default(300)->comment('有效期/秒');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sms');
    }
}
